<html>
<head>
<script type="text/javascript">

function load() {
	chrome.windows.getCurrent(function(currentWindow) {
		chrome.tabs.getSelected(currentWindow.id, function(currentTab){ 
			var newTabId = -1;

			// have to use a listener to wait for the tab to finish loading
			chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
				if (tabId == newTabId) {
					if (changeInfo.status == 'complete') { 
						chrome.tabs.sendRequest(tabId, {recipeUrl: currentTab.url}, function(response) {
							// do nothing with the response
							newTabId = -1;
						});
					}
				}
			});
			
			chrome.tabs.create({url:'http://recipese.appspot.com/mvc/recipes'}, function(newTab) {			
				newTabId = newTab.id;
			});
		});
	});

}

</script>
</head>
<body>
</body>
</html>